two_level_self_organizing_map_utilities Module

This module defines a class that represents a two layer self_organizing_map for clustering


Uses

  • module~~two_level_self_organizing_map_utilities~~UsesGraph module~two_level_self_organizing_map_utilities two_level_self_organizing_map_utilities module~distance_base_utilities distance_base_utilities module~two_level_self_organizing_map_utilities->module~distance_base_utilities module~factory_distance_utilities factory_distance_utilities module~two_level_self_organizing_map_utilities->module~factory_distance_utilities module~kohonen_layer_parameters_utilities kohonen_layer_parameters_utilities module~two_level_self_organizing_map_utilities->module~kohonen_layer_parameters_utilities module~kohonen_map_base_utilities kohonen_map_base_utilities module~two_level_self_organizing_map_utilities->module~kohonen_map_base_utilities module~kohonen_pattern_utilities kohonen_pattern_utilities module~two_level_self_organizing_map_utilities->module~kohonen_pattern_utilities module~kohonen_prototype_utilities kohonen_prototype_utilities module~two_level_self_organizing_map_utilities->module~kohonen_prototype_utilities module~precision_utilities precision_utilities module~two_level_self_organizing_map_utilities->module~precision_utilities module~random_generator_base_utilities random_generator_base_utilities module~two_level_self_organizing_map_utilities->module~random_generator_base_utilities module~rkiss05_generator_utilities rkiss05_generator_utilities module~two_level_self_organizing_map_utilities->module~rkiss05_generator_utilities module~distance_base_utilities->module~precision_utilities module~factory_distance_utilities->module~distance_base_utilities error_handling error_handling module~factory_distance_utilities->error_handling module~constants_utilities constants_utilities module~factory_distance_utilities->module~constants_utilities module~correlation_distance_utilities correlation_distance_utilities module~factory_distance_utilities->module~correlation_distance_utilities module~direction_cosine_distance_utilities direction_cosine_distance_utilities module~factory_distance_utilities->module~direction_cosine_distance_utilities module~euclidean_distance_utilities euclidean_distance_utilities module~factory_distance_utilities->module~euclidean_distance_utilities module~manhattan_distance_utilities manhattan_distance_utilities module~factory_distance_utilities->module~manhattan_distance_utilities module~max_distance_utilities max_distance_utilities module~factory_distance_utilities->module~max_distance_utilities module~kohonen_layer_parameters_utilities->module~precision_utilities module~kohonen_layer_parameters_utilities->error_handling module~kohonen_layer_parameters_utilities->module~constants_utilities tomlf tomlf module~kohonen_layer_parameters_utilities->tomlf module~kohonen_map_base_utilities->module~kohonen_layer_parameters_utilities module~kohonen_map_base_utilities->module~kohonen_pattern_utilities module~kohonen_map_base_utilities->module~precision_utilities module~kohonen_pattern_utilities->module~kohonen_prototype_utilities module~kohonen_pattern_utilities->module~precision_utilities module~kohonen_pattern_utilities->error_handling module~kohonen_pattern_utilities->module~constants_utilities module~kohonen_prototype_utilities->module~distance_base_utilities module~kohonen_prototype_utilities->module~precision_utilities module~kohonen_prototype_utilities->error_handling module~kohonen_prototype_utilities->module~constants_utilities iso_fortran_env iso_fortran_env module~precision_utilities->iso_fortran_env module~random_generator_base_utilities->module~precision_utilities module~rkiss05_generator_utilities->module~precision_utilities module~rkiss05_generator_utilities->module~random_generator_base_utilities module~constants_utilities->module~precision_utilities module~correlation_distance_utilities->module~distance_base_utilities module~correlation_distance_utilities->module~precision_utilities module~general_utilities general_utilities module~correlation_distance_utilities->module~general_utilities module~direction_cosine_distance_utilities->module~distance_base_utilities module~direction_cosine_distance_utilities->module~precision_utilities module~euclidean_distance_utilities->module~distance_base_utilities module~euclidean_distance_utilities->module~precision_utilities module~manhattan_distance_utilities->module~distance_base_utilities module~manhattan_distance_utilities->module~precision_utilities module~max_distance_utilities->module~distance_base_utilities module~max_distance_utilities->module~precision_utilities module~general_utilities->module~precision_utilities

Used by

  • module~~two_level_self_organizing_map_utilities~~UsedByGraph module~two_level_self_organizing_map_utilities two_level_self_organizing_map_utilities module~two_level_som_estimate_variables two_level_som_estimate_variables module~two_level_som_estimate_variables->module~two_level_self_organizing_map_utilities module~two_level_som_train_variables two_level_som_train_variables module~two_level_som_train_variables->module~two_level_self_organizing_map_utilities

Derived Types

type, public, extends(kohonen_map_base) ::  two_level_self_organizing_map

Class to represent a two level self_organized_map

Type-Bound Procedures

procedure, public :: create => create_2lsom
procedure, public :: destroy => destroy_2lsom
procedure, public :: train => train_2lsom
procedure, public :: predict => predict_2lsom
procedure, public :: train_grid_layer
procedure, public :: train_cluster_layer
procedure, public :: print => print_2lsom
procedure, public :: query => query_2lsom
procedure, public :: set_cluster_layer
procedure, public :: set_parameters
procedure, public :: read_som_layer
procedure, public :: calculate_sum2_clusters_samples => evaluate_2lsom
procedure, public :: get_cluster_samples
procedure, public :: calculate_sum2_clusters_grid
procedure, public, nopass :: external_train_map Read more…

Functions

public function position2index(ix, iy, iz, nx, ny) result(index_)

Function to calculate the index inside a rectangular grid from position ix,iy,iz

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: ix

Integer variables ix,iy,iz,nx,ny

integer, intent(in) :: iy

Integer variables ix,iy,iz,nx,ny

integer, intent(in) :: iz

Integer variables ix,iy,iz,nx,ny

integer, intent(in) :: nx

Integer variables ix,iy,iz,nx,ny

integer, intent(in) :: ny

Integer variables ix,iy,iz,nx,ny

Return Value integer

Integer variable with the index



Subroutines

public subroutine create_2lsom(kohonen_map, training_parameters)

Constructor of a two_level self_organized_map class

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

type(kohonen_layer_parameters), dimension(:) :: training_parameters

A kohonen_layer_parameters structure

public subroutine destroy_2lsom(kohonen_map)

Destructor of a two_level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

public subroutine create_random_sample(kohonen_map, input)

Subroutine to generate random values that serve as inputs to the SOM

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A self_organizing_map object

real(kind=wp), intent(out), dimension(:,:) :: input

A real array with the initial values of the prototypes

public subroutine train_2lsom(kohonen_map, input_data)

Subroutine to train a two_level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

type(kohonen_pattern), intent(inout), dimension(:) :: input_data

A kohonen_pattern array

public subroutine predict_2lsom(kohonen_map, input_data, map_output)

Subroutine to make a prediction from a trained two_level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

type(kohonen_pattern), intent(inout), dimension(:) :: input_data

A kohonen_pattern array

integer, intent(out), dimension(:,:) :: map_output

An integer array

public subroutine train_grid_layer(kohonen_map, input_data)

Subroutine to train the grid layer of a two_level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

type(kohonen_pattern), intent(inout), dimension(:) :: input_data

A kohonen_pattern array

public subroutine train_cluster_layer(kohonen_map)

Subroutine to train the cluster layer of a two_level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

public subroutine print_2lsom(kohonen_map, unit_)

Subroutine to print the layers of a two_level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

integer, optional :: unit_

An integer variable with the unit

public subroutine set_cluster_layer(kohonen_map, seed)

Subroutine to initialize the cluster layer of a Two Level Self-Organizing Map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

integer :: seed

An integer variable with the random seed

public subroutine set_parameters(kohonen_map, training_parameters)

Subroutine to set parameters

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

type(kohonen_layer_parameters), dimension(2) :: training_parameters

public subroutine evaluate_2lsom(kohonen_map, input_data, results)

Subroutine to calculate some clustering statistics of a two-level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

type(kohonen_pattern), intent(inout), dimension(:) :: input_data

A kohonen_pattern array

real(kind=wp), optional, dimension(:) :: results

A real array

public subroutine calculate_sum2_clusters_grid(kohonen_map, results)

Subroutine to calculate some clustering statistics of a two-level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

real(kind=wp), optional, dimension(:) :: results

A real array

public subroutine calculate_cluster_measures(kohonen_map, results)

Subroutine to calculate some clustering statistics of a two-level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

real(kind=wp), dimension(:,:,:) :: results

A real array

public subroutine read_som_layer(kohonen_map, som_fl, layer_type)

Subroutine to read the prototypes of the first/seconf layer of a two level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

character(len=*) :: som_fl

A character variable

character(len=*) :: layer_type

A character variable

public subroutine query_2lsom(kohonen_map, input_pattern, sample_index)

Function to find the input samples associated with specific vector

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

real(kind=wp), intent(inout), dimension(:,:) :: input_pattern

A real array

integer, allocatable :: sample_index(:)

An integer array

public subroutine get_cluster_samples(kohonen_map, clusters)

Accessor to cluster results obtained using a two-level self_organized_map

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

integer, intent(inout), dimension(:) :: clusters

An integer array

public subroutine index2position(index_, nx, ny, nz, cx, cy, cz)

Subroutine to calculate the position ix,iy,iz inside a rectangular grid from index

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: index_

Integer variables, index_,nx,ny,nz

integer, intent(in) :: nx

Integer variables, index_,nx,ny,nz

integer, intent(in) :: ny

Integer variables, index_,nx,ny,nz

integer, intent(in) :: nz

Integer variables, index_,nx,ny,nz

integer, intent(inout) :: cx

Integer variables cx,cy,cz

integer, intent(inout) :: cy

Integer variables cx,cy,cz

integer, intent(inout) :: cz

Integer variables cx,cy,cz

public subroutine calculate_distance_matrix(coordinates, distance_matrix, grid_type, toroidal)

Subroutine to calculate the distance between the units inside a kohonen layer

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout), dimension(:,:) :: coordinates

A real array

real(kind=wp), intent(inout), dimension(:,:) :: distance_matrix

A real array

character(len=*) :: grid_type

A character varaible

logical :: toroidal

A logical variableS

public subroutine calculate_coordinates(current_index, ix, iy, iz, nx, ny, nz, coordinates, node_type)

Subroutine to calculate the coordinates of the units inside a kohonen layer

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: current_index

Integer variables

integer, intent(in) :: ix

Integer variables

integer, intent(in) :: iy

Integer variables

integer, intent(in) :: iz

Integer variables

integer, intent(in) :: nx

Integer variables

integer, intent(in) :: ny

Integer variables

integer, intent(in) :: nz

Integer variables

real(kind=wp), intent(out), dimension(:,:) :: coordinates

Real array

character(len=*), intent(in) :: node_type

Character variable

public subroutine find_best_match_unit(kohonen_map, current_prototype, ihit, jhit, khit, dist_hit)

Subroutine to calculate the best match unit

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

type(kohonen_prototype), intent(inout) :: current_prototype

A kohonen_prototype object

integer, intent(out) :: ihit

Integer variables

integer, intent(out) :: jhit

Integer variables

integer, intent(out) :: khit

Integer variables

real(kind=wp), intent(out) :: dist_hit

A real variable

public subroutine update_weights(kohonen_map, current_values, ihit, jhit, khit, maximum_radius, iteration)

Subroutine to update the weights

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

real(kind=wp), intent(inout), dimension(:,:) :: current_values

A real array

integer, intent(inout) :: ihit

Integer variables

integer, intent(inout) :: jhit

Integer variables

integer, intent(inout) :: khit

Integer variables

real(kind=wp), intent(inout) :: maximum_radius

A real variable with the maximum radius

integer, intent(inout) :: iteration

Integer variables

public subroutine calculate_distance_between_prototypes(kohonen_map)

Subroutine to calculate distance between prototypes

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

public subroutine calculate_u_matrix(kohonen_map)

Subroutine to calculate the u_matrix

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

public subroutine assign_input_to_clusters(kohonen_map, input_patterns)

Subroutine to assign input to clusters

Arguments

Type IntentOptional Attributes Name
class(two_level_self_organizing_map) :: kohonen_map

A two_level_self_organizing_map object

type(kohonen_pattern), intent(inout), dimension(:) :: input_patterns

A kohonen_pattern array

public subroutine external_train_map(x, nvar, npat, som_type, nx1, ny1, nepoch1, alpha1, grid_type1, distance_type1, neigh_type1, toroidal1, nx2, nepoch2, alpha2, grid_type2, prot, distortion, u_matrix, coords, number_patterns, node_index) bind(C, name="train_2lsom")

Subroutine to connect the two_level_self_organizing_map module to R o C Use iso_c_binding module

Arguments

Type IntentOptional Attributes Name
real(kind=c_double), intent(in) :: x(npat,nvar)

Real variables

integer(kind=c_int), intent(in) :: nvar

Integere variables

integer(kind=c_int), intent(in) :: npat

Integere variables

integer(kind=c_int), intent(in) :: som_type

Integere variables

integer(kind=c_int), intent(in) :: nx1

Integere variables

integer(kind=c_int), intent(in) :: ny1

Integere variables

integer(kind=c_int), intent(in) :: nepoch1

Integere variables

real(kind=c_double), intent(in) :: alpha1

Real variables

integer(kind=c_int), intent(in) :: grid_type1

Integer variables

integer(kind=c_int), intent(in) :: distance_type1

Integer variables

integer(kind=c_int), intent(in) :: neigh_type1

Integer variables

integer(kind=c_int), intent(in) :: toroidal1

Integere variables

integer(kind=c_int), intent(in) :: nx2

Integer variables

integer(kind=c_int), intent(in) :: nepoch2

Integer variables

real(kind=c_double), intent(in) :: alpha2

Real variables

integer(kind=c_int), intent(in) :: grid_type2

Integer variables

real(kind=c_double), intent(out) :: prot(nx1*ny1,nvar)

Real variables

real(kind=c_double), intent(out) :: distortion(nepoch1)

Real variables

real(kind=c_double), intent(out) :: u_matrix(2*nx1-1,2*ny1-1)

Real variables

real(kind=c_double), intent(out) :: coords(nx1*ny1,3)

Real variables

integer(kind=c_int), intent(out) :: number_patterns(nx1,ny1)

Integer variables

integer(kind=c_int), intent(out) :: node_index(npat,3)

Integer variables